package cn.iocoder.yudao.module.scrm.dal.mysql.marketing;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.scrm.controller.admin.marketing.vo.visitor.MarketingVisitorPageReqVO;
import cn.iocoder.yudao.module.scrm.dal.dataobject.marketing.MarketingVisitorDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 营销访客数据 Mapper
 *
 * @author admin
 */
@Mapper
public interface MarketingVisitorMapper extends BaseMapperX<MarketingVisitorDO> {

    default PageResult<MarketingVisitorDO> selectPage(MarketingVisitorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MarketingVisitorDO>()
                .eqIfPresent(MarketingVisitorDO::getContentId, reqVO.getContentId())
                .eqIfPresent(MarketingVisitorDO::getTransmitId, reqVO.getTransmitId())
                .eqIfPresent(MarketingVisitorDO::getSource, reqVO.getSource())
                .eqIfPresent(MarketingVisitorDO::getSourceType, reqVO.getSourceType())
                .likeIfPresent(MarketingVisitorDO::getName, reqVO.getName())
                .eqIfPresent(MarketingVisitorDO::getPhone, reqVO.getPhone())
                .betweenIfPresent(MarketingVisitorDO::getEndLookTime, reqVO.getEndLookTime())
                .eqIfPresent(MarketingVisitorDO::getAllLookCount, reqVO.getAllLookCount())
                .betweenIfPresent(MarketingVisitorDO::getAllLookTime, reqVO.getAllLookTime())
                .eqIfPresent(MarketingVisitorDO::getShareCount, reqVO.getShareCount())
                .eqIfPresent(MarketingVisitorDO::getBrowseCount, reqVO.getBrowseCount())
                .eqIfPresent(MarketingVisitorDO::getShareViewCount, reqVO.getShareViewCount())
                .likeIfPresent(MarketingVisitorDO::getPrincipalName, reqVO.getPrincipalName())
                .eqIfPresent(MarketingVisitorDO::getLinkId, reqVO.getLinkId())
                .eqIfPresent(MarketingVisitorDO::getStatus, reqVO.getStatus())
                .eqIfPresent(MarketingVisitorDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(MarketingVisitorDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MarketingVisitorDO::getId));
    }

}